package com.zhuchaooasystem.api;


import android.content.Context;

import com.zhuchaooasystem.utils.AppUtils;
import com.zhuchaooasystem.utils.EncryptUtils;
import com.zhuchaooasystem.utils.RandomUtils;

import java.util.HashMap;
import java.util.Map;

import okhttp3.MediaType;

/**
 *
 */
public class HttpUtil {

    private static final String SystemNum = "android"; //系统版本号
    private static final String key = "testinterface";

    public static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=utf-8");


    /**
     * 获取验证接口的预传参数
     *
     * @return
     */
    public static Map<String, String> getHttpMap(Context context) {
        Map<String, String> map = new HashMap<>();
        String nonce_str = EncryptUtils.MD5(String.valueOf(RandomUtils.getRandomNumberFour()));
        String sign = EncryptUtils.getSign(context, nonce_str);
        map.put("Version", AppUtils.getAppVersionName(context));
        map.put("SystemNum", SystemNum);
        map.put("nonce_str", nonce_str);
        map.put("sign", sign);
        return map;
    }
}
